#pragma once

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <string>
#include <clocale>
#include <algorithm>
#include <vector>
#include "interval.h";

using namespace std;

int main(){

	setlocale(LC_ALL, "swedish");

	interval<double> iv_a(5.5, 1);
	interval<double> iv_b(6.2, 1);

	//cout << iv_a << endl;
	//cout << iv_b << endl;

	interval<double> iv_c;
	interval<double> iv_d;

	iv_c.setLower(5.40);
	iv_c.setUpper(5.60);

	iv_d.setLower(6.10);
	iv_d.setUpper(6.30);

	cout << iv_c << endl;
	cout << iv_d << endl;
	cout << "Relative: " << iv_d.relative_error() * 100 << "%" << endl;
	cout << "Absolute: " << iv_d.absolute_error() << endl;

	cout << iv_c << " + " << iv_d << " = " << iv_c + iv_d << endl;
	cout << iv_c << " - " << iv_d << " = " << iv_c - iv_d << endl;
	cout << iv_c << " * " << iv_d << " = " << iv_c * iv_d << endl;

	cout << iv_c << " / " << iv_d << " = " << iv_c / iv_d << endl;

	cout << endl;

	interval<double> u1(5, 1);
	interval<double> i1(2, 1);
	cout << "R1 = " << u1 / i1 << endl;
	cout << "P1 = " << u1 * i1 << endl;

	interval<double> u2(5, 2);
	interval<double> i2(2, 2);
	cout << "R2 = " << u2 / i2 << endl;
	cout << "P2 = " << u2 * i2 << endl;

	interval<double> u3(5, 2);
	interval<double> i3(2, 4);
	cout << "R3 = " << u3 / i3 << endl;
	cout << "P3 = " << u3 * i3 << endl;


	system("pause");
	return 0;
}